<template>
	<div>
		<!--- 用户上传推荐内容 -->
		标题：<input type="text" name="title" v-model="title" ><br>
		内容：<input type="text" name="content" v-model="content"><br>
		分享类型：
		<select v-model="shareType">
		  <option value="01">书籍</option>
		  <option value="02">网址</option>
		  <option value="03">博客</option>
		</select><br>
		描述：
			<input type="text" name="description" v-model="description"><br>
		公开：
			<input type="radio" id="private" value="01" v-model="secret"><label for="private">私有</label>
			<input type="radio" id="public" value="02" v-model="secret"><label for="public">公有</label><br>
		归类：
		<select v-model="contentType">
		  <option value="01">java</option>
		  <option value="02">javascript</option>
		  <option value="03">html</option>
		  <option value="04">css</option>
		  <option value="05">spring</option>
		</select><br>
		<a v-on:click="addShare()" class="btn btn-primary" style="cursor: default;">发布</a><br><br><br>
		<!-- 推荐内容的列表 -->

		<!-- 标题：<input type="text" name="iTitle" v-model="iTitle"><br>
		内容：<input type="text" name="iContent" v-model="iContent">
		开始时间：<input type="text" name="beginDate" v-model="beginDate">
		结束时间：<input type="text" name="endDate" v-model="endDate">
		描述：<input type="text" name="iDescription" v-model="iDescription">
		分享类型：
			<select v-model="iShareType">
			  <option value="01">书籍</option>
			  <option value="02">网址</option>
			  <option value="03">博客</option>
			</select><br>
		归类：
		<select v-model="iContentType" multiple>
		  <option value="01">java</option>
		  <option value="02">javascript</option>
		  <option value="03">html</option>
		  <option value="04">css</option>
		  <option value="05">spring</option>
		</select><br> -->

		<!-- 显示一些其它的内容 -->
		<a v-on:click="pageTest()" class="btn btn-primary" style="cursor: default;">测试分页的功能</a>
		<a v-on:click="queryShareList()" class="btn btn-primary" style="cursor: default;">查询测试</a>
		<a v-on:click="shareTest()" class="btn btn-primary" style="cursor: default;">ddfdfdfd</a>
		<img src="huhx" alt="hello world" id="huhxImage">
		<div style="text-align:right; position:absolute; bottom:0px;right:0px;">
			<ul class="pagination clearfix"></ul>
		</div>
	</div>
</template>

<script>
	Learn.learn = function() {
		return {
			data: function() {
				return {
					title: "",
					content: "",
					description: "",
					type: "01", // 分享
					secret: "02",
					contentType: "01",
					shareType: "02"
				}
			},
			created: function() {
				console.log("login created.");
			},
			methods: {
				addShare: function() {
					var data = {
						Title: this.title,
						Content: this.content,
						Description: this.description,
						Type: this.type,
						Secret: this.secret,
						ContentType: this.contentType,
						UserId: store.state.login.userId,
						ShareType: this.shareType
					}
					var vm = this;
					vm.$http.post('shareAction/userShare.action', data).then((response) => {
						if (response.body.returnCode == "000000") {
							var data = response.body.data;

							toastr.info("successful");
						} else {
							toastr.info(response.body.errorMsg);
						}
					}, (response) => {
						toastr.info(response.body.returnMsg);
					})
				},
				pageTest: function() {
					toastr.info("hello world");
					 $('ul.pagination').paginate({
						 count       : 5,        //每个页码组的页码数
						 start       : 1,  //开始页数
						 totalPage   : 10, //总的页数
						 showFirst   :true,  //显示首页
						 showLast    :true,  //显示末页
						 fixBottom   :false,      //固定在底部
						 // mouse       :'press',
						 onChange    : function(page){
						 	toastr.info("page has changed");
						 }
					 });
				},
				queryShareList: function() {

				},
                shareTest: function () {
                    var vm = this;
                    vm.$http.post('qrCodeAction.do', {}).then((response) => {
                        if (response.body.returnCode == "000000") {
                        var resp = response.body.data;
                        console.log(resp.byte);
                        console.log(resp.string);
                        console.log(resp.str);
                        toastr.info("successful");
                    } else {
                        toastr.info(response.body.errorMsg);
                    }
                }, (response) => {
                        toastr.info(response.body.returnMsg);
                    })
                }
			}
		}
	}
</script>

<style>
	.login-btn {
		background-color: #FF0000;
	}
</style>